home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / PartMaker 4.4 / PartMaker Documents / Script Runner• / Script Runner•.rsrc / dFRK_5047 < prev    next >
Encoding:
Text File  |  1995-12-12  |  2.5 KB  |  116 lines

  1. /*------------------------------------------------------------------------------
  2.     File:        CScripter.h
  3.     
  4.     Contains:    C++ class definition.
  5.  
  6.     Written by:    Sue Dumont
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. ------------------------------------------------------------------------------*/
  10.  
  11. #ifndef _CSCRIPTER_
  12. #define _CSCRIPTER_
  13.  
  14.  
  15. // --- OpenDoc Includes ---
  16.  
  17. #ifndef _ODTYPES_
  18. #include <ODTypes.h>
  19. #endif
  20.  
  21. #ifndef SOM_ODDesc_xh
  22. #include <ODDesc.xh>
  23. #endif
  24.  
  25. // -- OpenDoc Utilities --
  26.  
  27. #ifndef _ITEXT_
  28. #include <IText.h>
  29. #endif
  30.  
  31. #ifndef _ODDEBUG_
  32. #include <ODDebug.h>
  33. #endif
  34.  
  35. #ifndef _ODUTILS_
  36. #include <ODUtils.h>
  37. #endif
  38.  
  39. // -- Macintosh Includes --
  40.  
  41. #ifndef __APPLEEVENTS__
  42. #include <AppleEvents.h>
  43. #endif
  44.  
  45.  
  46. //------------------------------------------------------------------------------
  47. // CScripter Class Definition
  48. //------------------------------------------------------------------------------
  49.  
  50. class CScripter
  51. {
  52.     public:
  53.         CScripter();
  54.         ~CScripter();
  55.     
  56.         ODScriptingConnection    OpenScriptingComponent();
  57.     
  58.         void            ReleaseScriptData();                 
  59.         void            SetScriptDirty();                 
  60.         ODBoolean        IsDirty();
  61.         ODDesc*            GetScriptSourceDesc();                    
  62.         void            SetScriptSourceDesc(ODDesc* source);  
  63.         ODBoolean        GetScriptSourceBA(ODPlatformType wantType, ODByteArray* data);                    
  64.         void            SetScriptSourceBA(ODPlatformType type, ODByteArray* source);  
  65.     
  66.         ODOSAID            GetOSAScriptID();                    
  67.         void            SetOSAScriptID(ODOSAID scriptID);    
  68.     
  69.         ODOSAID            GetScriptResult();                    
  70.         
  71.         void             DoCompile();                    
  72.         void            DoDecompile();                    
  73.         void            DoRun();                     
  74.     
  75.         void            GetResultAsODDesc(ODDescType type, ODDesc* result);
  76.         ODISOStr        GetResultAsText(Environment* ev);
  77.         
  78.         void            GetError(ODDescType kind, ODDescType type, ODDesc* result);
  79.         ODISOStr        GetErrorMessage(Environment* ev);
  80.         ODISOStr        GetErrorAppName(Environment* ev);
  81.         
  82.     private:
  83.         ODScriptingConnection     fComponent;        // OSA component connection
  84.         AEDesc*                    fSource;        // Current script source
  85.         ODOSAID                    fScriptID;        // Current script object id
  86.         ODOSAID                    fResultValue;    // Last returned result
  87.         ODBoolean                fScriptDirty;    // Is script dirty?
  88. };
  89.  
  90.  
  91. //-------------------------------------------------------------------------
  92. // Inline methods
  93. //-------------------------------------------------------------------------
  94.  
  95. inline ODOSAID CScripter::GetScriptResult()
  96. {
  97.     return this->fResultValue;
  98. }
  99.  
  100. inline ODOSAID CScripter::GetOSAScriptID()
  101. {
  102.     return this->fScriptID;
  103. }
  104.  
  105. inline ODBoolean CScripter::IsDirty()
  106. {
  107.     return this->fScriptDirty;
  108. }
  109.  
  110. inline void CScripter::SetScriptDirty()
  111. {
  112.     this->fScriptDirty = kODTrue;
  113. }
  114.  
  115.  
  116. #endif